<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<div id="content">		
		<%@ include file="../common/hello.jsp"%>
		<div id="maincontent">
			<p class="title-function">VIEW BALANCE</p>
			<div class="caption">Account List</div>
			<table class="tblList">
				<tr class="tblhead">
					<td>Account number</td>
					<td>Type</td>
					<td>Status</td>
				</tr>
				<c:forEach items="${accountList}" var="acc" varStatus="i">
					<tr>
						<td>
							<c:if test="${accIdList[0][i.index]==acc.accId}">
								<a href="view_balance?acc=${accIdList[1][i.index]}">${acc.accId}</a>
							</c:if>
						</td>
						<td>${acc.accType}</td>
						<td>
							<c:if test="${acc.accStatus}"> Enable</c:if> 
							<c:if test="${not acc.accStatus}"> Disable</c:if>
						</td>
					</tr>
				</c:forEach>
			</table>
			<br />
			<div class="caption">Account Details</div>
			<table class="tblDetail">
				<tr>
					<td class="tblLeft">CUSTOMER NAME</td>
					<td style="text-transform: uppercase">${sessionScope.userName}</td>
				</tr>
				<tr>
					<td class="tblLeft">ACCOUNT NUMBER</td>
					<td><strong id="accId">${account.accId}</strong></td>
				</tr>
				<tr>
					<td class="tblLeft">BALANCE</td>
					<td>
					<fmt:formatNumber type="number" maxFractionDigits="3" value="${account.balance}"/>
					VND
					</td>
					
				</tr>
				<tr>
					<td class="tblLeft">TYPE</td>
					<td>${account.accType}</td>
				</tr>
				<tr>
					<td class="tblLeft">ACCOUNT STATUS</td>
					<td>
						<c:if test="${account.accStatus}"> Enable</c:if> 
						<c:if test="${not account.accStatus}"> Disable</c:if>
					</td>
				</tr>
			</table>
			<br />			
			<a onclick="return checkAcc();" href="downloadPDF/balance?acc=${accCode}"><img align="right" alt="Print to PDF file" src="resources/image/printer-green.png" width="35px;"/></a>
			<div id="errorPrint"></div>			
		</div>
	</div>